package com.app.service.impl;

import com.app.mapper.CusItemExpMapper;
import com.app.mapper.MsgRecordMapper;
import com.app.model.CusItemExpModel;
import com.app.model.LivePortendModel;
import com.app.model.MsgRecordModel;
import com.app.service.CusItemExpService;
import com.app.service.CustomerService;
import com.app.service.MsgRecordService;
import com.app.service.UserService;
import com.app.util.StringTool;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;


/**
 * @Description:发送短信记录表
 */
@Service
public class MsgRecordServiceImpl implements MsgRecordService {
    @Autowired
    UserService userService;
    @Autowired
    MsgRecordMapper msgRecordMapper;


    @Override
    public MsgRecordModel getModelByTime(Integer cusId,String time) {
        QueryWrapper<MsgRecordModel> queryWrapper = new QueryWrapper<>();
        if (cusId!=null&&cusId>0) {
            queryWrapper.eq("customer_id", cusId);
        }
        if (StringTool.isNotEmpty(time)) {
            queryWrapper.ge("crt_time", time);
        }
        List<MsgRecordModel> modelList = msgRecordMapper.selectList(queryWrapper);
        if(modelList!=null&&modelList.size()>0)
        {
            return modelList.get(0);
        }else{
            return null;
        }

    }

    @Override
    public Integer insert(MsgRecordModel model) {
        return msgRecordMapper.insert(model);
    }
}
